<template>
  <el-container>
    <basic-crud v-model="formData" :option="option" businessUrl="/bd/unitController">
    </basic-crud>
  </el-container>
</template>

<script setup>
const formData = ref({})
const option = {
  menuWidth: 270,
  searchShow: false,
  selection: false,
  isTableTree: true,
  menuWidth: 260,
  addSonBtn: true,
  calcHeight: 10,
  column: [
    {
      label: "状态",
      prop: "status",
      sortable: true,
      search: true,
      searchType: "select",
      display: false,
      labelWidth: 140,
      statusTag: true,
      enumCode: 'statusDic',
      width: 120,
    },
    {
      label: "单位编号",
      prop: "code",
      searchLabelWidth: 120,
      search: true,
      sortable: true,
      labelWidth: 140,
      rules: [{ required: true, message: "单位编号不能为空" }],
      width: 200
    },
    {
      label: '单位名称',
      prop: 'name',
      labelWidth: 140,
      searchLabelWidth: 120,
      search: true,
      sortable: true,
      rules: [{ required: true, message: "单位名称不能为空" }],
      width: 200
    },
    {
      label: '是否主单位',
      type: 'switch',
      prop: 'primaryUnit',
      labelWidth: 140,
      dicData: [{
        label: '是',
        value: 'true'
      }, {
        label: '否',
        value: 'false'
      }],
      value: 'true',
      width: 120,
      formatter: (val) => {
        return val.primaryUnit == 'true' ? "是" : "否";
      }
    },
    {
      label: '与主单位换算比例',
      type: 'number',
      prop: 'conversionRate',
      precision: 8,
      labelWidth: 140,
      rules: [{ type: 'number', message: "换算比例必须为数字" }],
      width: 120
    },
    {
      label: "描述",
      type: 'textarea',
      span: 24,
      prop: "des",
      sortable: true,
    },
  ],
}
</script>

<style lang="scss" scoped></style>
